package com.dq.repository.org;

import com.dq.domain.record.MaintainRecord;
import com.dq.domain.sys.user.user.WxUser;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author liuhui
 * @date 2019/11/26 0026 13:53:42
 */
@Repository
public interface MaintainRecordRepository extends JpaRepository<MaintainRecord,Long> {
    /**
     * 根据用户和门店查询跟踪记录，结果对开始时间进行降序排序
     * @param wxUser
     * @param pageable
     * @return
     */
    Page<MaintainRecord> findByWxUserOrderByCreateTimeDesc(WxUser wxUser, Pageable pageable);

    /**
     * 统计跟踪记录 检索条件是用户和门店
     * @param wxUser
     * @return
     */
    Long countByWxUser(WxUser wxUser);

    List<MaintainRecord> findByMaintainStatusAndDeletedFalse(MaintainRecord.MaintainStatus status);
}
